#include<iostream>
#define maxsize 100
using namespace std;
typedef int ElemType;
typedef struct {
	ElemType data[maxsize];
	int front,rear;
} SqQueue;
void number(ElemType n,ElemType m);
int main(){
	int n,m;
	cin>>n>>m;
	number(n,m);
}
void number(ElemType n,ElemType m){
	ElemType i,e;
	SqQueue q;
	q.front=q.rear=0;
	if(m>n){
		printf("error!\n");
		return; 
	}
	for(i=1;i<=n;i++){
		q.rear=(q.rear+1)%maxsize;
		q.data[q.rear]=i;
	}
	while(q.front!=q.rear){
		q.front=(q.front+1)%maxsize;
		e=q.data[q.front];
		if(q.front%m==0) {
			if(q.front==q.rear) printf("%d",e);
			else printf("%d ",e); 
		}
		else{
			e=q.data[q.front];
			q.rear=(q.rear+1)%maxsize;
			q.data[q.rear]=e;
		}
	}
	printf("\n");
}

